var targetPath;
var basePath;
var comm_rundemo=true;//demo离线运行模式
//公共参数初始化
$(document).ready(function(){
    basePath();
});
    function basePath(){
    //获取当前网址，如： http://localhost:8080/ems/Pages/Basic/Person.jsp
    var curWwwPath = window.document.location.href;
    //获取主机地址之后的目录，如： /ems/Pages/Basic/Person.jsp
    var pathName = window.document.location.pathname;
    var pos = curWwwPath.indexOf(pathName);
    //获取主机地址，如： http://localhost:8080
    var localhostPath = curWwwPath.substring(0, pos);
    //获取带"/"的项目名，如：/Metro
    var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1);
    //获取项目的basePath   http://localhost:8080/Metro/
    basePath=localhostPath+projectName+"/";
    //ajax调用地址
    if(localhostPath.lastIndexOf(":")  > 4)
    {
        targetPath = localhostPath.substring(0,localhostPath.lastIndexOf(":"));
        targetPath = targetPath + ":10080";
    }else{
        targetPath = localhostPath + ":10080";
    }
    ;
};


function showLeft(){
		$(".left").hide();
		$(".left1").show();
	}
function showLeft1(){
		$(".left").show();
		$(".left1").hide();
}

function setMenu(obj,src){
	if (!src) {
		src="";
	}
	getWeek();
	$("#"+obj).attr("src",src+"static/images/menu/"+obj+"-2.png");
	$("#"+obj+" a").attr("href","#");
//	if(obj=="plan"){
//		$("#plan").attr("src",src+"static/images/menu/plan-2.png");
//	}else if(obj=="emcs"){
//		$("#emcs").attr("src",src+"static/images/menu/emcs-2.png");
//	}else{
//		//fas
//		$("#fas").attr("src",src+"static/images/menu/FAS-2.png");
//	}
}

function getWeek()
{
	var d = new Date();
	var weekday=new Array(7);
	weekday[0]="星期日";
	weekday[1]="星期一";
	weekday[2]="星期二";
	weekday[3]="星期三";
	weekday[4]="星期四";
	weekday[5]="星期五";
	weekday[6]="星期六";
	var x = document.getElementById("week");
	x.innerHTML=weekday[d.getDay()];
}

function getPlatform(){
	var platformclass = $('#platform').attr('class');
	if(platformclass=="platform"){
		$(".platfromlist").show();
		$("#platform").removeClass("platform");
		$("#platform").addClass("platform1");
	}else{
		$(".platfromlist").hide();
		$("#platform").removeClass("platform1");
		$("#platform").addClass("platform");
	}
}







function initial_pagetitle(){
    //文件路径 例如：/Metro/view/s01/plan/plan.jsp 切分处理
    var stationname=window.location.pathname
    var temp_t=stationname.split("/");
    if(temp_t.length>3){
        key_t=temp_t[3];
        stationname=station_dic[key_t];
        if(stationname !=undefined){
            var content_t= document.getElementById("page_title").innerText;
            document.getElementById("page_title").innerText=stationname+content_t;
        }
    }
    
}

var station_dic={
    "s01":"松江南站",
    "s02":"醉白池",
    "s03":"松江体育中心",
    "s04":"松江新城",
    "s05":"松江大学城",
    "s06":"洞泾",
    "s07":"佘山",
    "s08":"泗泾",
    "s09":"九亭",
    "s10":"中春路",
    "s11":"七宝",
    "s12":"星中路",
    "s13":"合川路",
    "s14":"漕河泾开发区",
    "s15":"桂林路",
    "s16":"宜山路",
    "s17":"徐家汇",
    "s18":"肇嘉浜路",
    "s19":"嘉善路",
    "s20":"打浦桥",
    "s21":"马当路",
    "s22":"陆家浜路",
    "s23":"小南门",
    "s24":"商城路",
    "s25":"世纪大道",
    "s26":"杨高中路",
    "s27":"芳甸路",
    "s28":"蓝天路",
    "s29":"台儿庄路",
    "s30":"金桥",
    "s31":"金吉路",
    "s32":"金海路",
    "s33":"顾唐路",
    "s34":"民雷路",
    "s35":"曹路",
}

